#pragma once
#include "instrument.h"
#include "ADSR.h"
#include "AdditiveSynth.h"

class CAdditiveSynthInstrument :
	public CInstrument
{
public:
	CAdditiveSynthInstrument(void);
	~CAdditiveSynthInstrument(void);

	virtual void Start();
    virtual bool Generate();
    virtual void SetNote(CNote *note);
    
    void SetDuration(double d) {m_adsr.SetDuration(d); m_addSynth.SetDuration(d);}
    void SetFreq(double f) {m_addSynth.SetFreq(f);}

	void SetAmplitude(int i, double d) {m_addSynth.SetAmplitude(i, d);}
	void SetAmplitudeFade(int i, double d) {m_addSynth.SetAmplitudeFade(i, d);}

	void SetADSR(double a, double d, double r, double af) {m_attack = a; m_decay = d; m_release = r; m_attackFactor = af;}

	void SetVibrato(bool v, double vf, double m) {m_addSynth.SetVibrato(v, vf, m);}

private:
    CADSR			m_adsr;
    double			m_time;
	CAdditiveSynth	m_addSynth;

	double			m_attack;
	double			m_decay;
	double			m_release;
	double			m_attackFactor;
};

